package edu.qqcui.study.test;

import edu.qqcui.study.bean.Boss;
import edu.qqcui.study.bean.Car;
import edu.qqcui.study.bean.Color;
import edu.qqcui.study.config.MainConifgOfAutowired;
import edu.qqcui.study.service.BookService;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * TODO
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2021-06-27 09:37
 **/
public class IOCTestForAutowired {

	@Test
	public void test01() {
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConifgOfAutowired.class);

		BookService bookService = applicationContext.getBean(BookService.class);
		System.out.println(bookService);

		//BookDao bean = applicationContext.getBean(BookDao.class);
		//System.out.println(bean);

		Boss boss = applicationContext.getBean(Boss.class);
		System.out.println(boss);
		Car car = applicationContext.getBean(Car.class);
		System.out.println(car);

		Color color = applicationContext.getBean(Color.class);
		System.out.println(color);
		System.out.println(applicationContext);
		applicationContext.close();
	}
}
